using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace CustomControlsCS
{
    [ToolboxData("<{0}:Chapter3Custom runat=server></{0}:Chapter3Custom>")]
    public class Chapter3Custom : WebControl
    {
        protected override void CreateChildControls()
        {
            System.Web.UI.WebControls.Label lbl = new System.Web.UI.WebControls.Label();
            System.Web.UI.WebControls.Panel pnl = new System.Web.UI.WebControls.Panel();
            System.Web.UI.WebControls.Button btn = new System.Web.UI.WebControls.Button();
            System.Web.UI.WebControls.TextBox txt = new System.Web.UI.WebControls.TextBox();

            pnl.BorderStyle = System.Web.UI.WebControls.BorderStyle.Solid;
            pnl.BorderWidth = 1;
            pnl.Wrap = true;

            lbl.BorderStyle = System.Web.UI.WebControls.BorderStyle.Solid;
            lbl.BorderWidth = 1;
            lbl.Text = "In a Custom Control";
            pnl.Controls.Add(lbl);

            txt.Text = "In a Custom Control";
            pnl.Controls.Add(txt);

            btn.Text = "In a Custom Control";
            pnl.Controls.Add(btn);

            this.Controls.Add(pnl);            
        }
    }
}
